#ifndef CT_VOIP_LOSTPACKET_H_
#define CT_VOIP_LOSTPACKET_H_

#include <set>
#include <vector>
#include "command.h"

#define MAX_SEQ_NO_OFFSET       100
#define MAX_UPDATE_DELAY        5*1000 // 5s
#define MAX_TIME_OUT            60*1000 // 60s

class ctVOIPLostPacket {
public:
        typedef std::set<DWORD> ctSeqNoSet;

public:
        ctVOIPLostPacket(DWORD userid);
        ~ctVOIPLostPacket() { }

        void push(DWORD seqno);
        void calculateLostRate();
        bool isTimeOut();
        WORD getLostRate();

protected:
        void reset();
        DWORD getTickCount();

private:
        DWORD user_id_;
        WORD lost_rate_;
        DWORD max_seq_no_;
        DWORD min_seq_no_;
        DWORD last_update_time_;
        ctSeqNoSet set_seq_no_;
};
#endif // CT_VOIP_LOSTPACKET_H_

